package org.example.ruoxing_admin_springboot3.utils;
/**
 * @description  MD5加密工具类
 * @author 莫若省
 * @createTime 2024/4/29
*/
public class Md5Util {
    public static String createMD5Key(String str) {
        try {
            java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
            byte[] array = md.digest(str.getBytes());
            StringBuilder sb = new StringBuilder();
            for (byte item : array) {
                sb.append(Integer.toHexString((item & 0xFF) | 0x100), 1, 3);
            }
            return sb.toString();
        } catch (java.security.NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return "";
    }
}
